package com.apes.hr.area.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.hr.area.model.DeptArea;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;


/**
 * @Title: DeptAreaRepository
 * @Description:
 * @author: ZhengZeXian
 * @create: 2021/8/19 10:48
 */
public interface DeptAreaRepository extends CustomRepository<DeptArea, String> {

    @Query(value = "SELECT MAX(T.ID) FROM MAS_DEPT_AREA T WHERE 1 = 1 AND T.ID like :code || '___'",nativeQuery = true)
    String findMaxId(@Param("code") String value);

    DeptArea findByParentsAndName(DeptArea parent,String name);

    DeptArea findByName(String nane);

    List<DeptArea> findByIdIn(List ids);
}
